<%@ page import="java.sql.DriverManager" %>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.sql.PreparedStatement" %><%--
  Created by IntelliJ IDEA.
  User: 吧
  Date: 2020/12/1
  Time: 14:22
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>删除教师信息</title>
</head>
<body>

</body>
<%
    Class.forName("com.mysql.jdbc.Driver");
    String url="jdbc:mysql://localhost:3306/lixiuying";
    Connection connection= DriverManager.getConnection(url,"root","root");
    String sql="delete from teacher where id=?";
    PreparedStatement pstm=connection.prepareStatement(sql);
    pstm.setInt(1,Integer.parseInt(request.getParameter("id")));
    int count=pstm.executeUpdate();
    if(count>0)
    {
        out.print("<h2>操作成功,即将返回教师信息页面</h2>");
        response.setHeader("refresh","3,url=SelectNews.jsp");
    }
    else
    {
        out.print("<h2>操作失败，即将返回教师信息页面</h2>");
        response.setHeader("refresh","3,url=SelectNews.jsp");
    }
%>
</html>
